package com.easy.config;

import com.easy.interceptor.LoginInterceptor;
import com.easy.interceptor.UserLoginInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class UserWEBConfig implements WebMvcConfigurer {
    //添加拦截器
    @Override
    public void addInterceptors(InterceptorRegistry registry)
    {
        UserLoginInterceptor userloginInterceptor = new UserLoginInterceptor();
        //放行地址   "/regist" 注册地址,"/login" 登录地址
        registry.addInterceptor(userloginInterceptor).
                //拦截地址
                addPathPatterns("/userindex/**").
                //不拦截的地址
                excludePathPatterns("/userlogin/captcha","/userlogin/dologin");
    }
}

































